import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { WelfareService } from './welfare.service';
import { CreateWelfareDto, FindWelfareDto, UpdateWelfareDto } from './welfare.dto';
// import { Authorize } from 'src/core/decorators/index.decorator';

@ApiTags('福利管理')
@ApiBearerAuth()
@Controller('welfare')
export class WelfareController {
  constructor(private welfareService: WelfareService) {}

  @Get('list')
  // @Authorize()
  @ApiOperation({ summary: '获取福利列表' })
  async getWelfareList(@Query() query: FindWelfareDto) {
    return await this.welfareService.find(query);
  }

  @Post('create')
  @ApiOperation({ summary: '新增福利' })
  async createWelfare(@Body() data: CreateWelfareDto) {
    return await this.welfareService.create(data);
  }

  @Put('update')
  @ApiOperation({ summary: '更新福利' })
  async updateWelfare(@Body() data: UpdateWelfareDto) {
    return await this.welfareService.update(data);
  }
}
